<template>
	<view class="data_detail_container">
		<view class="data_detail_box">
			<view class="" v-if="fxuserDataList.length !== 0">
				<!-- top -->
				<view class="detail_top_box">
					<view class="top_total_box">
						总计<span class="top_total_num">{{countAll}}</span><span class="top_total_unit">(单)</span>
					</view>
					<!-- <view class="top_compare_box">
						<view class="top_compare_yesterday">
							较昨日<span class="top_compare_num">3</span>
						</view>
						<view class="top_compare_down"></view>
					</view> -->
				</view>

				<view class="detail_order_box" v-for="(item, index) in fxuserDataList" :key="index">
					<view class="" style="border-bottom: 1px solid #F2F2F2;">
						<view class="order_user_box">
							<view class="user_name_box">
								姓名：{{ item.id_card_name }}
							</view>
							<view class="user_name_box">
								身份证号：<span style="font-family: my-font;">{{ item.id_card ? item.id_card.replace(/^(.{4})(?:\w+)(.{4})$/, 
				"\$1******\$2"):"" }}</span>
							</view>
						</view>
						<view class="order_user_box">
							<view class="user_name_box">
								手机号：<span style="font-family: my-font;">{{ item.mobile }}</span>
							</view>
							<view class="user_name_box">
								订单号：<span style="font-family: my-font;">{{ item.order_no }}</span>
							</view>
						</view>
					</view>

					<view class="order_package_box">
						<view class="package_msg_box">
							<!-- <view class="package_img_box">
							<image src="/static/home/img-popup.png" mode="" class="package_img"></image>
						</view> -->
							<view class="package_title_box">
								<view class="package_title">
									{{ item.package_name }}
								</view>
								<view class="package_date">
									下单时间：<span style="font-family: my-font;">{{ item.created_at }}</span>
								</view>
							</view>
						</view>
						<view class="package_price_box">
							<view class="package_price">
								￥ 0.00
							</view>
							<view class="package_count">
								x 1
							</view>
						</view>
					</view>

					<view class="order_status_box" v-if="dataType == 'fxuserTodayFaOrder'">
						<view class="order_status">
							发货成功
						</view>
						<!-- <view class="order_disbursements">
						<span class="disbursements_title">实付款</span> ￥ <span class="disbursements_price">0.00</span>
					</view> -->
					</view>
				</view>
			</view>

			<view class="no_data" v-else>
				----- 暂无数据 -----
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataType: '',
				fxuserDataList: [],
				countAll: '',
				pageObj: {
					pageNow: 1,
					pageSize: 10
				},
				total: 0,
				isShowBottom: false
			}
		},
		onLoad(option) {
			if (this.pageObj.pageNow == this.total) {
				return
			} else {
				this.dataType = option.type
				this.countAll = option.countAll
				this.getAgentDataCount()
			}
		},
		onReachBottom() {
			if (this.pageObj.pageNow < this.total) {
				this.pageObj.pageNow++
				this.getAgentDataCount()
			} else if (this.pageObj.pageNow == this.total) {
				uni.showToast({
					title: '暂无更多数据',
					icon: 'none'
				})
				return
			}
		},
		methods: {
			// 数据统计接口
			getAgentDataCount() {
				this.$request('/api/getAgentDataCount', {
					type: this.dataType,
					page_now: this.pageObj.pageNow,
					page_size: this.pageObj.pageSize
				}, 'GET').then(res => {
					if (res.code == 1) {
						res.data.forEach(item => {
							this.fxuserDataList.push(item)
						})

						this.total = res.page_info.page_count
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						})
						return
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.data_detail_container {
		padding: 12rpx 10rpx 0;

		.data_detail_box {

			.detail_top_box {
				display: flex;
				justify-content: center;
				background: #FFFFFF;
				border-radius: 8rpx;
				padding: 32rpx 0 34rpx;
				margin-bottom: 14rpx;

				.top_total_box {
					font-family: all-font;
					font-weight: 400;
					font-size: 20rpx;
					color: #333333;

					.top_total_num {
						font-family: my-font;
						font-weight: bold;
						font-size: 58rpx;
						color: #333333;
					}

					.top_total_unit {
						font-family: all-font;
						font-size: 24rpx;
					}
				}

				.top_compare_box {
					display: flex;
					align-items: center;
					height: 31rpx;
					background: #F2F2F2;
					border-radius: 15rpx;
					padding: 0 18rpx;

					.top_compare_yesterday {
						font-family: Source Han Sans CN;
						font-weight: 400;
						font-size: 20rpx;
						color: #808080;
						padding: 0 8rpx;

						.top_compare_num {
							font-family: Source Han Sans CN;
							font-weight: 400;
							font-size: 21rpx;
							color: #00C580;
						}
					}

					.top_compare_down {
						width: 0;
						height: 0;
						border-left: 10rpx solid transparent;
						border-right: 10rpx solid transparent;
						border-top: 10rpx solid #00C580;
					}

					.top_compare_up {
						width: 0;
						height: 0;
						border-top: 0 solid transparent;
						border-right: 10rpx solid transparent;
						border-left: 10rpx solid transparent;
						border-bottom: 10rpx solid #FF2B2B;
					}
				}
			}

			.detail_order_box {
				background: #FFFFFF;
				box-shadow: 0px 8rpx 12rpx 1px #F4F4F4;
				border-radius: 12rpx;
				padding: 25rpx 20rpx 19rpx 32rpx;
				margin-bottom: 20rpx;

				.order_user_box {
					display: flex;
					padding-bottom: 22rpx;

					.user_name_box {
						font-family: all-font;
						font-weight: 400;
						font-size: 26rpx;
						color: #666666;
						margin-right: 26rpx;
					}
				}

				.order_package_box {
					display: flex;
					justify-content: space-between;
					// border-bottom: 1px solid #F2F2F2;
					padding-top: 26rpx;

					.package_msg_box {
						display: flex;

						.package_img_box {
							width: 157rpx;
							height: 128rpx;
							margin-right: 24rpx;

							.package_img {
								width: 100%;
								height: 100%;
								border-radius: 12rpx;
							}
						}

						.package_title_box {

							.package_title {
								width: 266rpx;
								font-family: all-font;
								font-weight: 400;
								font-size: 28rpx;
								color: #333333;
							}

							.package_date {
								font-family: all-font;
								font-weight: 400;
								font-size: 24rpx;
								color: #999999;
								padding-top: 25rpx;
							}
						}
					}

					.package_price_box {
						font-family: my-font;

						.package_price {
							font-weight: 400;
							font-size: 21rpx;
							color: #333333;
							padding-bottom: 21rpx;
						}

						.package_count {
							font-weight: 400;
							font-size: 16rpx;
							color: #B3B3B3;
							text-align: right;
						}
					}
				}

				.order_status_box {
					display: flex;
					justify-content: space-between;
					border-top: 1px solid #F2F2F2;
					padding-top: 20rpx;
					margin-top: 20rpx;

					.order_status {
						font-family: all-font;
						font-weight: 400;
						font-size: 26rpx;
						color: #FF1313;
					}

					.order_disbursements {
						font-size: 21rpx;

						.disbursements_title {
							font-family: Source Han Sans CN;
							font-weight: 400;
							font-size: 24rpx;
							color: #333333;
							padding-right: 31rpx;
						}

						.disbursements_price {
							font-family: my-font;
							font-weight: 400;
							font-size: 33rpx;
							color: #333333;
						}
					}
				}
			}

			.no_data {
				color: #ccc;
				font-size: 40rpx;
				font-family: all-font;
				text-align: center;
				padding: 50rpx 0;
			}
		}
	}
</style>